
//引入登录接口
import { req_login } from "@/api/registerLogin"

export default {
   async login_a({ commit },{ user_name, password, routerT }) {
        console.log(user_name, password, routerT);
        console.log(req_login);

        let result = await req_login({
            method: 'post', url: '/login', arg: {
                user_name, password
            }, headerType: 'form'
        })
        console.log(result);
        if(result.data.info == '登录成功！！'){
            // 当登录成功之后进行跳转
            routerT.push({
                name:'home'
            })
        }

        commit('login',{user_name,info:result.data.info,token:result.data.token});
        console.log(commit);

    }
}